/**
 * @file bull_hal_config.h
 * @brief 
 * @author yejing (yejh@gongniu.cn)
 * @version 1.0
 * @date 2024-05-14
 * 
 * Copyright 2024-2025 GongNiu Inc. All Rights Reserved.
 * 
 */

#ifndef __BULL_HAL_CONFIG_H__
#define __BULL_HAL_CONFIG_H__

#include  "sdkconfig.h"
#include "driver/gpio.h"

#ifdef __cplusplus
extern "C" {
#endif


// #define SPL_GATEWAY_PROJECT

//大小端选择
#define LITTLE_END 1

#if defined(CONFIG_C200_PROJECT)

// hal_sys_uart 配置
#define MAX_HAL_UART_PORTS      ( 3 )

#define BULL_UART_TXD1_PIN (GPIO_NUM_18) 
#define BULL_UART_RXD1_PIN (GPIO_NUM_17)

#define BULL_UART_TXD2_PIN (GPIO_NUM_47) //GPIO_NUM_21
#define BULL_UART_RXD2_PIN (GPIO_NUM_21) //GPIO_NUM_47

#define BULL_UART_MAX_RX_BUFFER_SIZE ( 2*1024 )
#define BULL_UART_MAX_TX_BUFFER_SIZE ( 2*1024 )


// 产测相关GPIO口配置
#define ELOG_PORT_NUM        0
#define CSK6012_PORT_NUM     1
#define BLE_MESH_PORT_NUM    2
#define MF_TEST_PORT_NUM     0


// bull mesh硬件复位引脚
#define BULL_MESH_HW_RESET_PIN  (48)


// 旋钮引脚定义
#define BULL_KNOB_PIN_A    (16)
#define BULL_KNOB_PIN_B    (8)
#define BULL_KNOB_PIN_D    (15)


#elif defined(CONFIG_SPL_GATEWAY_PROJECT)

// hal_sys_uart 配置
#define MAX_HAL_UART_PORTS      ( 3 )

#define BULL_UART_TXD1_PIN (GPIO_NUM_17) 
#define BULL_UART_RXD1_PIN (GPIO_NUM_18)

#define BULL_UART_TXD2_PIN (GPIO_NUM_21) //GPIO_NUM_21
#define BULL_UART_RXD2_PIN (GPIO_NUM_47) //GPIO_NUM_47

#define BULL_UART_MAX_RX_BUFFER_SIZE ( 2*1024 )
#define BULL_UART_MAX_TX_BUFFER_SIZE ( 2*1024 )



// 产测相关GPIO口配置
#define ELOG_PORT_NUM        0
#define CAN_PORT_NUM         1
#define BLE_MESH_PORT_NUM    2
#define MF_TEST_PORT_NUM     0


// 产测GPIO
#define PTEST_PIN (GPIO_NUM_5)


// bull mesh硬件复位引脚
#define BULL_MESH_HW_RESET_PIN  (GPIO_NUM_7)

// 86_STATE
#define STATE86_LED_STA_PIN  (GPIO_NUM_8)

// MCU RST
#define SMCU_RST_PIN  (GPIO_NUM_9)


// EMB_STATE
#define EMB_LED_STATE_PIN  (GPIO_NUM_10)


// CAN控制GPIO口
#define CAN_RCTL1_PIN (GPIO_NUM_39)
#define CAN_RCTL2_PIN (GPIO_NUM_40)


// 红外控制GPIO口
#define IR_TX_PIN (GPIO_NUM_19)
#define IR_RX_PIN (GPIO_NUM_20)

#elif defined(CONFIG_ESP_NOW_C3_PROJECT)

// hal_sys_uart 配置
#define MAX_HAL_UART_PORTS      ( 2 )

#define BULL_UART_TXD1_PIN (BULL_GPIO_NUM_19) 
#define BULL_UART_RXD1_PIN (BULL_GPIO_NUM_18)

#define BULL_UART_MAX_RX_BUFFER_SIZE ( 2*1024 )
#define BULL_UART_MAX_TX_BUFFER_SIZE ( 2*1024 )


// 产测相关GPIO口配置
#define ELOG_PORT_NUM        0
#define F1C200S_UART_NUM     1
#define BLE_MESH_PORT_NUM    2
#define MF_TEST_PORT_NUM     0


// bull mesh硬件复位引脚
#define BULL_MESH_HW_RESET_PIN  (48)


// 旋钮引脚定义
#define BULL_KNOB_PIN_A    (16)
#define BULL_KNOB_PIN_B    (8)
#define BULL_KNOB_PIN_D    (15)

#else
#error "please select project"
#endif


//选择测试产品
#define PRO_INF0_TYPE     2    //1：网关  2：子设备

#ifdef __cplusplus
}
#endif


#endif